class ShowLogsController < ApplicationController
  layout "base.html"

  def show
    @article = Article.find params[:id]
    @last_article = Article.first :conditions => ["author_id = ? and created_at < ?", @article.author.id, @article.created_at],
      :order => "created_at desc"
    @next_article = Article.first :conditions => ["author_id = ? and created_at > ?", @article.author.id, @article.created_at],
      :order => "created_at"
    @html_title = @article.author.nick_name + '的日志' + "-" + @article.title
    @html_description = @article.author.nick_name + '的日志' + "-" + @article.title
    #初始化日志浏览的评论
    @post = Post.new :article_id => @article.id,
      :created_by_valleyer_id => current_valleyer_id
    respond_to do |format|
      format.html do
        @valleyer = @article.author
      end
      format.js do
        render :layout => false
      end
    end
    #浏览article记录
    @browse_record = BrowseRecord.create(
      :article_id => @article.id,
      :browser_id => current_valleyer_id
    )
  end

  def authorize

  end
end
